package com.sm.dao;

import com.sm.entity.Welfare;
import org.apache.ibatis.annotations.*;
import org.omg.PortableInterceptor.INACTIVE;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface WelfareDao {

    //根据用户id查询出具有的所有福利
    @Select("select * from welfare where wid in (select wid from user_welfare where uid = #{uid})")
    public List<Welfare> findWelfareByUid(Integer uid);

    //查询所有奖惩条目
    @Select("select * from welfare")
    public List<Welfare> findAllWelfare();

    //查询奖惩id对应多少钱
    @Select("select welAmount from welfare where wid = #{wid}")
    public Double findAmountByWid(Integer wid);

    //添加福利表 描述 金额
    @Insert("insert into welfare(welDesc,welAmount,comment) values(#{welDesc},#{welAmount},#{comment})")
    public void addWelfare(Welfare welfare);

    //删除福利表描述
    @Delete("delete from where id = #{id}")
    public void deleteWelfare(Integer id);
}
